#include "Pixel.h"

Pixel::Pixel(unsigned int newrgb): rgb(newrgb)
{
}

Pixel::Pixel(const Pixel& rhs): rgb(rhs.rgb)
{
}

Pixel::~Pixel()
{
}

void Pixel::SetRgb(unsigned int newrgb)
{
	rgb = 0xFFFFFF & newrgb;
}

void Pixel::SetRed(unsigned int red)
{
	rgb = (rgb & 0xFFFF00) | (0x0000FF & (red<<0));
}

void Pixel::SetGreen(unsigned int green)
{
	rgb = (rgb & 0xFF00FF) | (0x00FF00 & (green<<8));
}

void Pixel::SetBlue(unsigned int blue)
{
	rgb = (rgb & 0x00FFFF) | (0xFF0000 & (blue<<16));
}

unsigned int Pixel::GetRgb() const
{
	return rgb;
}

unsigned int Pixel::GetRed() const
{
	return (rgb>>0) & 0xFF;
}

unsigned int Pixel::GetGreen() const
{
	return (rgb>>8) & 0xFF;
}

unsigned int Pixel::GetBlue() const
{
	return (rgb>>16) & 0xFF;
}
